public class Date {
    public int year;
    public int month;
    public int day;

    public Date(int year, int month, int day) {
        this.year = year;//成员变量会默认初始化，所以不会像下面的a一样
        this.month = month;
        this.day = day;
    }
    public void setDate()
    {
        System.out.println(this.year);
        System.out.println(this.month);
        System.out.println(this.day);
    }
    public static void main(String[] args) {
       Date date=new Date(2022,7,30);
       // int a;这里的a不能编译通过，因为没有初始化
       // System.out.println(a);
        date.setDate();
    }
}
